From 67799254d1c6d9e1ad5378ffa6dc04312e495c5d Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Mon, 19 Jun 2006 13:42:34 -0600 Subject: [PATCH] [IA64] display vmx fault messges This patch modifies the vmx fault handler to display a message when a fault occurs in hypervisor. This includes the followings: - Break 0 handler is modified to check psr.vm bit instead of cpl. - External interrupt handler is modified to get current using MINSTATE_GET_CURRENT instead of r21. r21 has been used in DO_SAVE_MIN which is called from other fault handlers. I'm not sure why the original vmx fault handler gets the current from r21. Signed-off-by: Kouya Shimura Signed-off-by: Tetsu Yamamoto --- xen/arch/ia64/vmx/vmx_ivt.S | 6 ++++-- xen/arch/ia64/vmx/vmx_process.c | 2 +- xen/arch/ia64/xen/ivt.S | 2 +- xen/arch/ia64/xen/xenmisc.c | 12 ++++++++++++ xen/include/asm-ia64/vmx.h | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/xen/arch/ia64/vmx/vmx_ivt.S b/xen/arch/ia64/vmx/vmx_ivt.S index c774247657..fc5d31cd52 100644 --- a/xen/arch/ia64/vmx/vmx_ivt.S +++ b/xen/arch/ia64/vmx/vmx_ivt.S @@ -88,11 +88,13 @@ #include "vmx_minstate.h" +#define MINSTATE_VIRT /* needed by minstate.h */ +#include "minstate.h" #define VMX_FAULT(n) \ vmx_fault_##n:; \ - br.sptk vmx_fault_##n; \ + br.sptk.many dispatch_to_fault_handler; \ ;; \ @@ -508,7 +510,7 @@ ENTRY(vmx_interrupt) ;; .mem.offset 0,0; st8.spill [r16]=r13,16 .mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */ - mov r13=r21 /* establish `current' */ + MINSTATE_GET_CURRENT(r13) ;; .mem.offset 0,0; st8.spill [r16]=r15,16 .mem.offset 8,0; st8.spill [r17]=r14,16 diff --git a/xen/arch/ia64/vmx/vmx_process.c b/xen/arch/ia64/vmx/vmx_process.c index c4391a8005..03865107e9 100644 --- a/xen/arch/ia64/vmx/vmx_process.c +++ b/xen/arch/ia64/vmx/vmx_process.c @@ -125,7 +125,7 @@ vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long is #endif { if (iim == 0) - die_if_kernel("bug check", regs, iim); + vmx_die_if_kernel("Break 0 in Hypervisor.", regs, iim); if (!user_mode(regs)) { /* Allow hypercalls only when cpl = 0. */ diff --git a/xen/arch/ia64/xen/ivt.S b/xen/arch/ia64/xen/ivt.S index 8fe29def28..338abdf834 100644 --- a/xen/arch/ia64/xen/ivt.S +++ b/xen/arch/ia64/xen/ivt.S @@ -1493,7 +1493,7 @@ END(dispatch_unaligned_handler) * suitable spot... */ -ENTRY(dispatch_to_fault_handler) +GLOBAL_ENTRY(dispatch_to_fault_handler) /* * Input: * psr.ic: off diff --git a/xen/arch/ia64/xen/xenmisc.c b/xen/arch/ia64/xen/xenmisc.c index ea10d97c6f..d1991af910 100644 --- a/xen/arch/ia64/xen/xenmisc.c +++ b/xen/arch/ia64/xen/xenmisc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -109,6 +110,17 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ( domain_crash_synchronous(); } +void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */ +{ + if (vmx_user_mode(regs)) + return; + + printk("%s: %s %ld\n", __func__, str, err); + debugtrace_dump(); + show_registers(regs); + domain_crash_synchronous(); +} + long ia64_peek (struct task_struct *child, struct switch_stack *child_stack, unsigned long user_rbs_end, unsigned long addr, long *val) diff --git a/xen/include/asm-ia64/vmx.h b/xen/include/asm-ia64/vmx.h index e25e471225..99ffb7b7ab 100644 --- a/xen/include/asm-ia64/vmx.h +++ b/xen/include/asm-ia64/vmx.h @@ -24,6 +24,7 @@ #define RR7_SWITCH_SHIFT 12 /* 4k enough */ #include +#define vmx_user_mode(regs) (((struct ia64_psr *)&(regs)->cr_ipsr)->vm == 1) #define VCPU_LID(v) (((u64)(v)->vcpu_id)<<24) -- 2.30.2